﻿using System;
using DosTexPrj.Core.Models;
using FluentNHibernate.Mapping;

namespace DosTexPrj.Implement.NHibernate.Mapping
{
    public class YarnOrderDetailMapping : ClassMap<YarnOrderDetail>
    {
        public YarnOrderDetailMapping()
        {
            Table("YarnOrderDetails");
            Id(x => x.Id, "YarnOrderDetailID").UnsavedValue(Guid.Empty).GeneratedBy.Guid();
            Map(x => x.Price, "Price").Not.Nullable();
            Map(x => x.QuantityOfBox, "QuantityOfBox").Not.Nullable();
            Map(X => X.Weigth, "Weight").Not.Nullable();
            References<Composition>(x => x.Composition).Column("CompositionID").Not.LazyLoad();
            References<YarnOrder>(x => x.YarnOrder).Column("YarnOrderID").Not.LazyLoad();
        }
    }
}